import {
  type ReactElement,
  lazy,
  Suspense,
} from 'react'

export const LazyLoad = (path: string): ReactElement => {
  const Comp = lazy(() => import(`@/pages/${path}`))
  return (
    <Suspense fallback="加载中...">
      <Comp />
    </Suspense>
  )
}

export default LazyLoad
